<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/7/12 0012
 * Time: 上午 1:52
 */

namespace App\Http\Classes;


use Illuminate\Support\Facades\DB;

abstract class Model
{
    private $tableName = '';
    private $tableDB = null;
    public $error = 0;
    public $message = [];
    public function __construct( $id = null )
    {
        $this->tableDB = DB::table( $this->tableName );

        if ( $id !== null )
        {
            $this->tableDB = $this->tableDB->where('id', '=', $id);
        }
    }

    abstract function setTable();

    public function getMessage()
    {
        return $this->message[ $this->error ];
    }
}